<?php 
 include_once dirname(__FILE__)."/config.php";
 class evaluateur_principal{
		 protected $_result;
		 protected $_cnn;
		 protected $_id;
		 protected $_CIN;
		 protected $_nom_enseig;
		 protected $_prenom_enseig;
		 protected $_tel_mobile;
		 protected $_tel;
		 protected $_fax;
		 protected $_mail;
		 protected $_grade;
		 protected $_specialite;
		 protected $_CODE_ETABLISSEMENT;
		 public function get_name_table(){ return "evaluateur";}
		 public function get_name_id(){ return "id";}
		 public function get_name_CIN(){ return "CIN";}
		 public function get_name_nom_enseig(){ return "nom_enseig";}
		 public function get_name_prenom_enseig(){ return "prenom_enseig";}
		 public function get_name_tel_mobile(){ return "tel_mobile";}
		 public function get_name_tel(){ return "tel";}
		 public function get_name_fax(){ return "fax";}
		 public function get_name_mail(){ return "mail";}
		 public function get_name_grade(){ return "grade";}
		 public function get_name_specialite(){ return "specialite";}
		 public function get_name_CODE_ETABLISSEMENT(){ return "CODE_ETABLISSEMENT";}
		 public function set_id($parametre){  $this->_id=$parametre;}	
		 public function set_CIN($parametre){  $this->_CIN=$parametre;}	
		 public function set_nom_enseig($parametre){  $this->_nom_enseig=$parametre;}	
		 public function set_prenom_enseig($parametre){  $this->_prenom_enseig=$parametre;}	
		 public function set_tel_mobile($parametre){  $this->_tel_mobile=$parametre;}	
		 public function set_tel($parametre){  $this->_tel=$parametre;}	
		 public function set_fax($parametre){  $this->_fax=$parametre;}	
		 public function set_mail($parametre){  $this->_mail=$parametre;}	
		 public function set_grade($parametre){  $this->_grade=$parametre;}	
		 public function set_specialite($parametre){  $this->_specialite=$parametre;}	
		 public function set_CODE_ETABLISSEMENT($parametre){  $this->_CODE_ETABLISSEMENT=$parametre;}	
		 public function get_result(){ return $this->_result;}
		 public function get_id(){ return $this->_id;}
		 public function get_CIN(){ return $this->_CIN;}
		 public function get_nom_enseig(){ return $this->_nom_enseig;}
		 public function get_prenom_enseig(){ return $this->_prenom_enseig;}
		 public function get_tel_mobile(){ return $this->_tel_mobile;}
		 public function get_tel(){ return $this->_tel;}
		 public function get_fax(){ return $this->_fax;}
		 public function get_mail(){ return $this->_mail;}
		 public function get_grade(){ return $this->_grade;}
		 public function get_specialite(){ return $this->_specialite;}
		 public function get_CODE_ETABLISSEMENT(){ return $this->_CODE_ETABLISSEMENT;}
public function __construct(){

		 	$this->_cnn=new databaseconnect();

		 }

 public function INSERT()
{

$sql=" INSERT INTO 
 evaluateur(
			CIN,
			nom_enseig,
			prenom_enseig,
			tel_mobile,
			tel,
			fax,
			mail,
			grade,
			specialite,
			CODE_ETABLISSEMENT)
 VALUES(
			'".$this->_CIN."',
			'".$this->_nom_enseig."',
			'".$this->_prenom_enseig."',
			'".$this->_tel_mobile."',
			'".$this->_tel."',
			'".$this->_fax."',
			'".$this->_mail."',
			'".$this->_grade."',
			'".$this->_specialite."',
			'".$this->_CODE_ETABLISSEMENT."')";

$this->_result=$this->_cnn->query($sql);
 if(!$this->_result){return 'erreur d\'execution de la requette';}else{return 'success';}
}

 public function UPDATE()
{

 $sql="";
if(!empty($this->_CIN)){
	if(!empty($sql)){$sql.=",";}
$sql.="		
CIN='".$this->_CIN."'";
}
if(!empty($this->_nom_enseig)){
	if(!empty($sql)){$sql.=",";}
$sql.="		
nom_enseig='".$this->_nom_enseig."'";
}
if(!empty($this->_prenom_enseig)){
	if(!empty($sql)){$sql.=",";}
$sql.="		
prenom_enseig='".$this->_prenom_enseig."'";
}
if(!empty($this->_tel_mobile)){
	if(!empty($sql)){$sql.=",";}
$sql.="		
tel_mobile='".$this->_tel_mobile."'";
}
if(!empty($this->_tel)){
	if(!empty($sql)){$sql.=",";}
$sql.="		
tel='".$this->_tel."'";
}
if(!empty($this->_fax)){
	if(!empty($sql)){$sql.=",";}
$sql.="		
fax='".$this->_fax."'";
}
if(!empty($this->_mail)){
	if(!empty($sql)){$sql.=",";}
$sql.="		
mail='".$this->_mail."'";
}
if(!empty($this->_grade)){
	if(!empty($sql)){$sql.=",";}
$sql.="		
grade='".$this->_grade."'";
}
if(!empty($this->_specialite)){
	if(!empty($sql)){$sql.=",";}
$sql.="		
specialite='".$this->_specialite."'";
}
if(!empty($this->_CODE_ETABLISSEMENT)){
	if(!empty($sql)){$sql.=",";}
$sql.="		
CODE_ETABLISSEMENT='".$this->_CODE_ETABLISSEMENT."'";
}
$sql="UPDATE 
evaluateur SET 
 ".$sql."
								WHERE CIN ='".$this->_CIN."'";

$this->_result=$this->_cnn->query($sql);
 if(!$this->_result){return 'erreur d\'execution de la requette';}else{return 'success';}
}

 public function DELETE(){

 $sql="DELETE FROM 
evaluateur 
 
									WHERE CIN ='".$this->_CIN."'";

$this->_result=$this->_cnn->query($sql);
 if(!$this->_result){return 'erreur d\'execution de la requette';}else{return 'success';}
}

 public function TRANCATE(){

 $sql="DELETE FROM 
evaluateur ";

$this->_result=$this->_cnn->query($sql);
 if(!$this->_result){return 'erreur d\'execution de la requette';}else{return 'success';}
}

 public function SELECT($constraint="",$pagination="")
{

$sql=" SELECT 
 		id,
		CIN,
		nom_enseig,
		prenom_enseig,
		tel_mobile,
		tel,
		fax,
		mail,
		grade,
		specialite,
		CODE_ETABLISSEMENT
 FROM 
 evaluateur";
if($constraint){$sql.=" WHERE 1=1 ".$constraint;}if($pagination){$sql.=$pagination;}
$this->_result=$this->_cnn->query($sql);
 if(!$this->_result){return 'erreur d\'execution de la requette';}else{return 'success';}
}
public function fetch_object(){
$row=mysql_fetch_object($this->_result);
 if($this->_result){
 if($row){
		$this->_id=$row->id;
		$this->_CIN=$row->CIN;
		$this->_nom_enseig=$row->nom_enseig;
		$this->_prenom_enseig=$row->prenom_enseig;
		$this->_tel_mobile=$row->tel_mobile;
		$this->_tel=$row->tel;
		$this->_fax=$row->fax;
		$this->_mail=$row->mail;
		$this->_grade=$row->grade;
		$this->_specialite=$row->specialite;
		$this->_CODE_ETABLISSEMENT=$row->CODE_ETABLISSEMENT;
		return $row;
		}else{
					return false;
				}

			}else{
				//echo 'Erreur d\'execution de requette de selection';	
			}
			

		}

}
?>